#include "armor.h"
#include "weapons.h"
#include "Character.h"

CHARACTER::CHARACTER()
{
	strength = 1;
	dexterity = 1;
	constitution = 1;
	wisdom = 1;
	charisma = 1;
	baseAttack = 0;
	maxHitPoints = 1;
	hitPoints = 1;
	gold = 0;
	name = "Unknown";

	gear.setBonus(0);
	gear.setName("None");
	gear.setPenalty(0);
	gear.setMaxDexterity(10);

	weapon.setName("Fists");
	weapon.setMinimumDamage(1);
	weapon.setMaximumDamage(3);
	weapon.setCriticalMinimum(20);
	weapon.setCriticalMultiplier(2);

}

void CHARACTER::addToKnapsack(Item thing)
{
	knapsack.push(thing);
}

Item CHARACTER::removeFromKnapsack()
{
	Item t;
	/*if (knapsack.empty())
		throw stackEmptyException();
	else
	{*/
		t = knapsack.top();
		knapsack.pop();
		return t;
	//}
}


int CHARACTER::getStr()
{
	return strength;
}

int CHARACTER::getStrMod()
{
	int mod;

	mod = (strength/2) - 5;

	return mod;
}

void CHARACTER::setStr(int str)
{
	strength = str;
}

int CHARACTER::getDex()
{
	return dexterity;
}

int CHARACTER::getDexMod()
{
	int mod;

	mod = (dexterity/2) - 5;

	return mod;
}

void CHARACTER::setDex(int dex)
{
	dexterity = dex;
}

int CHARACTER::getCon()
{
	return constitution;
}

int CHARACTER::getConMod()
{
	int mod;

	mod = (constitution/2) - 5;

	return mod;
}

void CHARACTER::setCon(int con)
{
	constitution = con;
}

int CHARACTER::getWis()
{
	return wisdom;
}

int CHARACTER::getWisMod()
{
	int mod;
	
	mod = (wisdom/2) - 5;

	return mod;
}

void CHARACTER::setWis(int wis)
{
	wisdom = wis;
}

int CHARACTER::getCha()
{
	return charisma;
}

int CHARACTER::getChaMod()
{
	int mod;

	mod = (charisma/2) - 5;

	return mod;
}

void CHARACTER::setCha(int cha)
{
	charisma = cha;
}

string CHARACTER::getName()
{
	return name;
}

void CHARACTER::setName(string nameums)
{
	name = nameums;
}

armor& CHARACTER::getArmor()
{
	return gear;
}

void CHARACTER::setArmor(armor& newGear)
{
	gear = newGear;
}

weapons& CHARACTER::getWeapon()
{
	return weapon;
}

void CHARACTER::setWeapon(weapons& newWeapons)
{
	weapon = newWeapons;
}

int CHARACTER::getBaseAttack()
{
	return baseAttack;
}

void CHARACTER::setBaseAttack(int baseAtk)
{
	baseAttack = baseAtk;
}

int CHARACTER::getMaxHitPoints()
{
	return maxHitPoints;
}

void CHARACTER::setMaxHitPoints(int maxHP)
{
	if(maxHP > 0)
		maxHitPoints = maxHP;
}

int CHARACTER::getHitPoints()
{
	return hitPoints;
}

void CHARACTER::setHitPoints(int HP)
{
	if(HP > 0)
		hitPoints = HP;
}

int CHARACTER::getGold()
{
	return gold;
}

void CHARACTER::setGold(int g)
{
	if(g > 0)
		gold = g;
}

int CHARACTER::getArmorClass()
{
	int armorClass = (getDexMod() + 10); //+ get armor bonus

	return armorClass;

}

void CHARACTER::display()
{
	system("CLS");

	cout<<"Name: "<<name<<"\n"<<"HP:   "<<hitPoints<<"/"<<maxHitPoints<<"\n\n";

	cout<<"Strength:     "<<strength<<"\n"
		<<"Constitution: "<<constitution<<"\n"
		<<"Charisma:     "<<charisma<<"\n"
		<<"Dexterity:    "<<dexterity<<"\n"
		<<"Wisdom:       "<<wisdom<<"\n\n";

	cout<<"Gold:"<<gold<<"\n\n\n";

	cout<<"*********************EQUIPMENT*********************\n\n";
	
	cout<<" ----------------------------Weapon----------------------------\n";

	weapon.display();

	cout<<" --------------------------------------------------------------\n\n";

	cout<<" ----------------------------Armor-----------------------------\n";
	
	gear.display();
	cout<<" --------------------------------------------------------------\n\n";
}